package com.huarui.dictionary.service;

import java.util.List;

import org.ewaf.framework.service.BaseService;

import com.huarui.dictionary.DictionaryEnum;
import com.huarui.dictionary.dao.IDictionaryDao;
import com.huarui.dictionary.model.Dictionary;

public class DictionaryService extends BaseService {

	

	private IDictionaryDao getDao() {

		return (IDictionaryDao) dao;
	}

	
	/**
	 * 得到组别
	 * 
	 * @return
	 */
	public List<String> getGroupList() {

		
		return getDao().geGropList();
	}

	public DictionaryEnum[] getGroupValues() {

		return DictionaryEnum.values();

	}

	/**
	 * 根据组名得到同组的字典数据
	 * 
	 * @param group
	 * @return
	 */
	public List<Dictionary> getSubDictionaryListByGroup(String group) {

		return getDao().getSubDictionaryList(group);
	}

	/**
	 * 增加字典记录
	 * 
	 * @param dictionary
	 */
	public void createDictionary(Dictionary dictionary) {

		getDao().create(dictionary);
	}

	/**
	 * 更新字典记录
	 * 
	 * @param dictionary
	 * @return
	 */
	public boolean updateDictionary(Dictionary dictionary) {

		return getDao().update(dictionary);
	}

	/**
	 * 根据主键查询字典信息
	 * 
	 * @param id
	 * @return
	 */
	public Dictionary getDictionaryById(int id) {

		return (Dictionary) getDao().getById(id);

	}
}
